/**
 * 获取根标签上的css变量
 * @returns 
 */
export function getRootCssVariables() {
  const cssVars = []
  Array.from(document.styleSheets).forEach((sheet) => {
    Array.from(sheet.cssRules).forEach((rule) => {
      if (rule instanceof CSSStyleRule && rule.selectorText === ':root') {
        Array.from(rule.style).forEach((name) => {
          if (name.startsWith('--')) {
            cssVars[name] = rule.style.getPropertyValue(name);
          }
        });
      }
    });
  });
  return cssVars
}